/*
*	ID : pallab81
* 	PROG : 315
* 	LANG : C++
* 	2011-10-04-14.06.08 Tuesday
*
* 	"I have not failed, I have just found 10000 ways that won't work.
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define fo(i,ed) foR( i , 0 , ed )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait(double seconds) {
    double endtime = clock()+(seconds * CLOCKS_PER_SEC);
    while (clock() < endtime) {
        ;
    }
}
int N;
vector< VI > edge;
int res;
int vis[200];
int dfn[200];
int low[200];
int itr;
int cut_points[200];
inline void ini(){
    edge.assign(N+1, VI() );
    SET(vis,0);
    SET(dfn,0);
    SET(low,0);
    SET(cut_points,0);
    itr=1;
    res=0;
}
inline int toI(string ss){
    int d;
    sscanf(ss.c_str(),"%d",&d);
return d;
}
inline void Read(){
    ini();
    scanf("\n");
    string line;
    int u,v;

    while( getline(cin,line) ){
        if( line=="0" )return ;

        stringstream ss(line);
        int prothom=1;
        for(string tmp = ""; getline(ss,tmp,' '); ){
            if( LN(tmp)<1 )continue;
            if( prothom ){
                prothom=0;
                u=toI(tmp);
            }
            else{
                v=toI(tmp);
                assert( u>=1 && u<=N);
                assert( v>=1 && v<=N);
                edge[u].pb(v);
                edge[v].pb(u);
            }
        }
    }
}
inline void dfs(int u, int p=-1){
    vis[u] =1;
    dfn[u]=low[u]=itr;
    ++itr;

    int sons=0;
    for(int i=0,j=SZ(edge[u]); i<j; ++i ){
        int v = edge[u][i];

        if( v==p )continue;
        if( vis[v]==1 ){
            dfn[u] = min( dfn[u], low[v] );
        }
        else{
            dfs(v,u);
            dfn[u] = min( dfn[u], dfn[v] );
            if( dfn[v] >= low[u] && p!=-1 ){
                cut_points[u]=1;
            }
            ++sons;
        }

    }
    if( p==-1 && sons>1 ){
        ++res;
        cut_points[u]=1;
    }
}
inline int totalCount(){
    int dd=0;
    for(int i=1;i<=N;++i){
        if( cut_points[i]==1  ){
            ++dd;
        }
    }
return dd;
}
inline void Proc(){
    dfs(1);
    printf("%d\n",totalCount());
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("in", "rt", stdin);
#endif

    while( scanf("%d",&N)==1 && N!=0 ){
        Read();
        Proc();
    }
    return 0;
}
